package com.yuyou.activity.gateway.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Status;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.yuyou.activity.gateway.handle.ActuatorHealthHandler;
import com.yuyou.activity.util.exception.CheckException;

@RestController
@RequestMapping(value="/health")
public class CheckController {
   
	@Autowired
	private ActuatorHealthHandler actuatorHealthHandler;

    @RequestMapping(value ="/ready",method = {RequestMethod.GET, RequestMethod.POST})
    public void ready(){
		Status status = actuatorHealthHandler.health().getStatus();
		if(status.equals(Status.UP)){
		}else{
			throw new CheckException("ready error");
		}
    }	
	


	
	
}
